home *** CD-ROM | disk | FTP | other *** search
Wrap
AAAABBBBIIIILLLLOOOOCCCCKKKK((((3333XXXX)))) AAAABBBBIIIILLLLOOOOCCCCKKKK((((3333XXXX)))) NNNNAAAAMMMMEEEE init_lock, acquire_lock, release_lock, stat_lock, spin_lock - ABI mutual exclusion primitives SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS ####iiiinnnncccclllluuuuddddeeee <<<<aaaabbbbiiii____mmmmuuuutttteeeexxxx....hhhh>>>> iiiinnnntttt iiiinnnniiiitttt____lllloooocccckkkk((((aaaabbbbiiiilllloooocccckkkk____tttt ****llllcccckkkk))));;;; iiiinnnntttt aaaaccccqqqquuuuiiiirrrreeee____lllloooocccckkkk((((aaaabbbbiiiilllloooocccckkkk____tttt ****llllcccckkkk))));;;; iiiinnnntttt rrrreeeelllleeeeaaaasssseeee____lllloooocccckkkk((((aaaabbbbiiiilllloooocccckkkk____tttt ****llllcccckkkk))));;;; iiiinnnntttt ssssttttaaaatttt____lllloooocccckkkk((((aaaabbbbiiiilllloooocccckkkk____tttt ****llllcccckkkk))));;;; vvvvooooiiiidddd ssssppppiiiinnnn____lllloooocccckkkk((((aaaabbbbiiiilllloooocccckkkk____tttt ****llllcccckkkk))));;;; DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN These routines provide a simple, standard interface to base level mutual exclusion primitives. They are found in the library ``libmutex.so'', and is loaded if the option ``-lmutex'' is used with _c_c(1) or _l_d(1). The parameter llllcccckkkk must point to memory shared by all processes wishing to acquire or test the lock. The contents of the structure aaaabbbbiiiilllloooocccckkkk____tttt are as follows: typedef struct { unsigned int abi_lock; } abilock_t; The function _iiii_nnnn_iiii_tttt______llll_oooo_cccc_kkkk must be called on a lock before any of the other functions. It initializes the lock to an unlocked state. A non-zero return status will indicate an error. _aaaa_cccc_qqqq_uuuu_iiii_rrrr_eeee______llll_oooo_cccc_kkkk tries once to acquire the lock referenced by llllcccckkkk. It returns zero if the lock was acquired, otherwise non-zero. _aaaa_cccc_qqqq_uuuu_iiii_rrrr_eeee______llll_oooo_cccc_kkkk can always fail, even if it is known that the lock is free and there is only one process, this implies that _aaaa_cccc_qqqq_uuuu_iiii_rrrr_eeee______llll_oooo_cccc_kkkk should always be called in a loop. _ssss_pppp_iiii_nnnn______llll_oooo_cccc_kkkk will always acquire the lock. If the lock is not immediately available, the calling process will either spin (busy-wait) or be suspended until the lock becomes available. There is no implied policy as to which (if there is more than one) waiting process will be granted the lock. _ssss_tttt_aaaa_tttt______llll_oooo_cccc_kkkk returns the current state of the lock referenced by llllcccckkkk without attempting to acquire the lock. It returns _UUUU_NNNN_LLLL_OOOO_CCCC_KKKK_EEEE_DDDD if the lock is free, otherwise _LLLL_OOOO_CCCC_KKKK_EEEE_DDDD. PPPPaaaaggggeeee 1111 AAAABBBBIIIILLLLOOOOCCCCKKKK((((3333XXXX)))) AAAABBBBIIIILLLLOOOOCCCCKKKK((((3333XXXX)))) _rrrr_eeee_llll_eeee_aaaa_ssss_eeee______llll_oooo_cccc_kkkk unconditionally releases the lock pointed to by llllcccckkkk. The ability for one process to release the lock of another process is permitted. A non-zero return status will indicate an error. These routines will work for locks shared between 32-bit and 64-bit user programs. SSSSEEEEEEEE AAAALLLLSSSSOOOO _nnnn_aaaa_nnnn_oooo_ssss_llll_eeee_eeee_pppp(2), _ssss_gggg_iiii_nnnn_aaaa_pppp(2), _uuuu_ssss_iiii_nnnn_iiii_tttt(3P). DDDDIIIIAAAAGGGGNNNNOOOOSSSSTTTTIIIICCCCSSSS iiiinnnniiiitttt____lllloooocccckkkk, aaaaccccqqqquuuuiiiirrrreeee____lllloooocccckkkk, and rrrreeeelllleeeeaaaasssseeee____lllloooocccckkkk return 0 if the operation was a success, otherwise a non-zero value. ssssppppiiiinnnn____lllloooocccckkkk returns no value. WWWWAAAARRRRNNNNIIIINNNNGGGGSSSS No locks are ever freed automatically by the system. Locks acquired by a process that terminates remain locked. Since looping is necessary when attempting to acquire a lock using _aaaa_cccc_qqqq_uuuu_iiii_rrrr_eeee______llll_oooo_cccc_kkkk, the user process could find itself in a long busy-wait loop. To avoid wasting CPU cycles, programs should implement some kind of back-off strategy, perhaps calling _ssss_gggg_iiii_nnnn_aaaa_pppp(2) or _nnnn_aaaa_nnnn_oooo_ssss_llll_eeee_eeee_pppp(2) after some number of unsuccessful calls to _aaaa_cccc_qqqq_uuuu_iiii_rrrr_eeee______llll_oooo_cccc_kkkk. Even though _ssss_tttt_aaaa_tttt______llll_oooo_cccc_kkkk returns status indicating that the lock is available, a call to _aaaa_cccc_qqqq_uuuu_iiii_rrrr_eeee______llll_oooo_cccc_kkkk could still fail. PPPPaaaaggggeeee 2222